package p1;

public class Recursive {

	public static int raddn(int n){
		if (n==0)
			return 0;
		int result = raddn( n-1 );
		return result + n;
	}
	public static int addn(int n){
		int result=0;
		for (int i=1; i<=n; i++)
			result = result + i;
		return result;
	}
	public static void main( String[] a ){
		final int N = 10;
		int result = addn( N );
		System.out.println( "Sum from 1 to " + N + " is " + result);
		result = raddn( N );
		System.out.println( "Recursive sum from 1 to " + N + " is " + result);
	}
}
